package com.shortvedio.base.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shortvedio.base.model.dto.VedioContentDto;
import com.shortvedio.base.model.po.Classify;
import com.shortvedio.base.model.po.UserInterest;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserInterestMapper extends BaseMapper<UserInterest> {

    @Select("SELECT * FROM videos_content WHERE TYPE in (SELECT TYPE FROM user_interest WHERE user_id = 1) AND status = 2 ORDER BY RAND() LIMIT 4")
    public List<VedioContentDto> getTypeList(@Param("userId")Long userId);//获取感兴趣的视频

    @Select("SELECT * FROM videos_content WHERE TYPE not in (SELECT TYPE FROM user_interest WHERE user_id = 1) AND status = 2 ORDER BY RAND() LIMIT #{count}")
    public List<VedioContentDto> getOtherTypeList(@Param("userId")Long userId,@Param("count")Integer count);//获取其他类型的视频


    @Select("SELECT * FROM classify WHERE id IN (SELECT TYPE FROM user_interest WHERE user_id = #{userId})")
    public List<Classify> getUserAddInterest(@Param("userId") Long userId);//获取感兴趣类型的列表
}
